<template>
  <div class="basics-container">
    <router-view />
    <div class="basics-text">
      <el-button type="danger" @click="formShow=true">新增模版</el-button>
      <div class="table">
        <!-- <table> -->
        <tr>
          <th>模版类型</th>
          <th>运送类型</th>
          <th>关联城市</th>
          <th>首重</th>
          <th>续重</th>
          <th>轻抛系数</th>
          <th>操作</th>
        </tr>
        <!-- </table> -->
      </div>
    </div>
    <el-dialog title="新增模版" :visible.sync="formShow">
      <el-form ref="roleForm" :model="roleForm" :rules="rules">
        <el-form-item label="模版类型" prop="formOfEmployment">
          <el-select v-model="roleForm.formOfEmployment" placeholder="请选择模版类型" style="width: 80%">
            <el-option label="正式" :value="1" />
            <el-option label="非正式" :value="2" />
          </el-select>
        </el-form-item>
        <el-form-item label="运输类型" prop="yunShuLeiXing">
          <el-select v-model="roleForm.yunShuLeiXing" placeholder="请选择运输类型" style="width: 80%">
            <el-option label="普快" :value="1" />
          </el-select>
        </el-form-item>
        <el-form-item prop="guanliChengshi" label="关联城市">
          <el-select v-model="roleForm.guanliChengshi" placeholder="请选择关联城市" style="width: 80%">
            <el-option label="全国" :value="1" />
          </el-select>
        </el-form-item>
        <el-form-item prop="shouzhong" label="首重价格">
          <el-input v-model="roleForm.shouzhong" style="width: 80%" placeholder="请输入首重价格"><span>元</span>
          </el-input>
        </el-form-item>
        <el-form-item prop="xuzhong" label="续重价格">
          <el-input v-model="roleForm.xuzhong" style="width: 80%" placeholder="请输入续重价格"><span>元</span>
          </el-input>
        </el-form-item>
        <el-form-item prop="qingpao" label="轻抛系数">
          <el-input v-model="roleForm.qingpao" style="width: 80%" placeholder="请输入轻抛系数"><span>元</span>
          </el-input>
        </el-form-item>

      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button
          type="primary"
          @click="addRole"
        >确 定</el-button>
        <el-button @click="callOff">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
      formShow: false,
      roleForm: {
        formOfEmployment: '',
        yunShuLeiXing: '',
        guanliChengshi: '',
        shouzhong: '',
        xuzhong: '',
        qingpao: ''
      },
      rules: {
        formOfEmployment: [{ required: true, message: '模版类型不能为空', trigger: 'blur' }],
        yunShuLeiXing: [{ required: true, message: '运输类型不能为空', trigger: 'blur' }],
        guanliChengshi: [{ required: true, message: '关联城市不能为空', trigger: 'blur' }],
        shouzhong: [{ required: true, message: '首重价格不能为空', trigger: 'blur' }],
        xuzhong: [{ required: true, message: '首重价格不能为空', trigger: 'blur' }],
        qingpao: [{ required: true, message: '轻抛系数不能为空', trigger: 'blur' }]
      }
    }
  },
  methods: {
    callOff() {
      this.formShow = false
      this.roleForm = { formOfEmployment: '', yunShuLeiXing: '', guanliChengshi: '', shouzhong: '', xuzhong: '', qingpao: '' }
    },
    addRole() {
      console.log('点击确定')
      this.roleForm = { formOfEmployment: '', yunShuLeiXing: '', guanliChengshi: '', shouzhong: '', xuzhong: '', qingpao: '' }
      this.formShow = false
    }

  }
}
</script>

<style lang="scss" scoped>
.basics-container{
  margin-top:50px ;
  padding: 20px;
  .basics-text{
    background-color: #fff;
    border-radius: 5px;
    padding: 25px;
  }
  .table{
    margin-top: 25px;
    height: 50px;
    background: #f8faff!important;
    th{
      width: 152px;
      padding: 15px;
      border-top: 1px solid #ebeef5;
      border-bottom: 1px solid #ebeef5;
    }
  }
}
.dialog-footer{
  display: flex;
  justify-content: center;
}
</style>
